Better fix
authorMatthias Clasen <matthiasc@src.gnome.org>
Wed, 12 Apr 2006 04:22:51 +0000 (04:22 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 12 Apr 2006 04:22:51 +0000 (04:22 +0000)
gtk/gtkicontheme.c

index a26e442743fc25e79e98945957eb1b9892df7ede..5cad504433225d1df7e150919433d09c08f94a51 100644 (file)
@@ -975,7 +975,13 @@ insert_theme (GtkIconTheme *icon_theme, const char *theme_name)
 
   dirs = g_key_file_get_string_list (theme_file, "Icon Theme", "Directories", NULL, NULL);
   if (!dirs)
-    g_warning ("Theme file for %s has no directories\n", theme_name);
+    {
+      g_warning ("Theme file for %s has no directories\n", theme_name);
+      g_free (theme->display_name);
+      g_free (theme);
+      g_key_file_free (theme_file);
+      return;
+    }
   
   theme->comment = 
     g_key_file_get_locale_string (theme_file, 
@@ -987,12 +993,11 @@ insert_theme (GtkIconTheme *icon_theme, const char *theme_name)
                           NULL);
 
   theme->dirs = NULL;
-  if (dirs)
-    {
-      for (i = 0; dirs[i] != NULL; i++)
-        theme_subdir_load (icon_theme, theme, theme_file, dirs[i]);
-      g_strfreev (dirs);
-    }
+  for (i = 0; dirs[i] != NULL; i++)
+    theme_subdir_load (icon_theme, theme, theme_file, dirs[i]);
+
+  g_strfreev (dirs);
+
   theme->dirs = g_list_reverse (theme->dirs);
 
   themes = g_key_file_get_string_list (theme_file,